from django.db import models
from account_sys.models import User
# Create your models here.
class History(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    content = models.TextField(verbose_name="历史内容")
    created_at = models.DateTimeField(auto_now_add=True)

    def parse_dict(self):
        return {
            "id": self.id,
            "user": self.user.info_to_dict(),
            "content": self.content,
            "created_at": self.created_at
        }